<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改</title>
	<style>
	html body {
	margin:0px;padding:0px}
	li{
	display: inline;
	margin-right:25px;
    padding-top:15px!important;
	}
	ul{
	margin-top:0px;
	padding-top:12px;
	}
	#One{
	margin-left:10%;
	}
	a{
	font-size:25px
	}
	#CD{
	height:60px;
	background-color:blue;
	}
	a{
	text-decoration:none
	}
	a a:link{
	color:white;
	}
	/*a:visited{
	color:white;
	}*/
	a:active{
	color:white;
	}
	a:hover {
	color:red!important;
	}
	#nr{
	margin-top:5%;
	margin-left:10%;}
	</style>
</head>
<body>
<div id="CD">
<ul>
<li id="One"><a href="findAllUser.html" ><font color="white">查询所有</font></a></li>
<li><a href="findOneUser.html" ><font color="white">查询单个</font></a></li>
<li><a href="save.html" ><font color="white">增加</font></a></li>
<li><a href="update.html" ><font color="white">删除</font></a></li>
<li><a href="update.html" ><font color="white">修改</font></a></li>
</ul>
</div>
<div id="nr">
<button>发送请求</button>
<br>
<br>

<table id="mytab" border="1">
    <tr id="htr">
        <th>#</th>
        <th>名</th>
        <th>姓</th>
        <th>邮箱</th>
        <th>手机号</th>
        <th>生日</th>
        <th>操作</th>
        <th>操作</th>
    </tr>
</table>
</div>
<script src="jquery-3.3.1.min.js">
</script>
<script>
    $(document).ready(function () {
        $('button').on('click',function() {
            var $tab1 = $("#mytab");

            $.ajax({
                url: "http://192.168.0.120:8080/customers",
                type: 'GET',
                dataType: 'json',
                data: "",
                success: function (data) { // 数据状态success
				$("#htr").nextAll().remove();
                    console.log(data);
                    alert(data);

                    for (var i = 0; i < data.length; i++) {
                        $tab1.append("<tr><td>" + data[i].id + "</td><td>" + data[i].firstName + "</td><td>" + data[i].lastName + "</td><td>"+ data[i].email + "</td><td>"
                            + data[i].mobile+ "</td><td>"
                            + data[i].dateOfBirth + "</td>+<td>" + "<a href='up3.html?id="+data[i].id+"'>修改</a>" + "</td>."
                            +"<td>" + "<a href='delete.html?id="+data[i].id+"'>删除</a>" + "</td>.");

                    }
                }
            })
        });
    })

</script>
</body>
</html>